package cn.anquing.controller;

import cn.anquing.model.City;
import cn.anquing.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class CityController {

    @Autowired
    private CityService cityService;

    @RequestMapping("/city/getCity")
    public Object getCity(@RequestParam("id") Long id){
        City city = cityService.selectByPrimaryKey(id);
        return city;
    }

    @RequestMapping("/city/transitionCity")
    public Object transitionCity(@RequestParam("id") Long id){
        cityService.transitionCity(id);
        City city = cityService.selectByPrimaryKey2(id);
        return city;
    }

}
